package com.heima.leetcode.practice;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: leetcode 168. Excel表列名称
 * @date 2025/9/18 23:18
 */
public class E168 {

    /**
     * 26进制转换
     * @param columnNumber
     * @return 转换后的字符串
     */
    public String convertToTitle(int columnNumber) {
        StringBuilder builder = new StringBuilder();
        while(columnNumber > 0){
            columnNumber--;
            int curr = columnNumber % 26;
            columnNumber /= 26;
            builder.append((char)(curr + 'A'));
        }
        return builder.reverse().toString();
    }
}
